import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { authGuard } from "./auth.guard";
import { HomeComponent } from "./pages/home/home.component";

import { UserInfoComponent } from "./pages/user-info/user-info.component";
import { CommonRoleComponent } from "./pages/common-role/common-role.component";
import { AdminRoleComponent } from "./pages/admin-role/admin-role.component";
import { UserListPermComponent } from "./pages/user-list-perm/user-list-perm.component";
import { AllPermComponent } from "./pages/all-perm/all-perm.component";
import { OpenidComponent } from "./pages/openid/openid.component";


const routes: Routes = [
    { path: '', component: HomeComponent, pathMatch: 'full' },
    { path: 'home', component: HomeComponent, pathMatch: 'full', canActivate: [authGuard] },
    { path: 'res-user', component: UserInfoComponent, pathMatch: 'full'},
    { path: 'res-common', component: CommonRoleComponent, pathMatch: 'full'},
    { path: 'res-admin', component: AdminRoleComponent, pathMatch: 'full'},
    { path: 'res-user-list', component: UserListPermComponent, pathMatch: 'full'},
    { path: 'res-all-perms', component: AllPermComponent, pathMatch: 'full'},
    { path: 'res-openid', component: OpenidComponent, pathMatch: 'full'}
]
@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
  })
  export class AppRoutingModule { }